package com.hoshiicloud.user.util.usercenter;

/**
 * 邀请码生成工具类
 *
 * @author : yangcheng
 * @date : 2019/5/14 16:58
 * @mail : maiboyc@163.com
 **/
public class InviteCodeUtil {

    // 生成的邀请码的基准
    private static String[] base = {"1","2","3","4","5","6","7","8","9"};

    private static String inviteCode = "";

    public static String createInviteCode(Long userId){
           int mod = (int) (userId % 61);
           userId = (userId-mod)/61;
           inviteCode += base[mod];
           if (userId > 0) {
               createInviteCode(userId);
           }
           return inviteCode;
    }

    public static void main(String[] args) {
        //System.out.println(createInviteCode(3207340701725491321L));
        System.out.println(Integer.MAX_VALUE);
    }
}